package IO;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("./images/KUAN.jpg");
        FileOutputStream fos = new FileOutputStream("./images/cype1.jpg");
                //创建字符数组       运载车，10240
                byte [] data = new byte[1024*10];
                int d ;
                long start = System.currentTimeMillis();//记录开始时间
                while ((d=fis.read(data))!= -1){  //如果读取到的字节为-1，就停止写入
                        fos.write(data,0,d);
                }
                long end = System.currentTimeMillis();//记录结束时间
        System.out.println("复制完毕，用时："+(end-start)+"ms");

    }
}
